package com.yys.controller;

import com.alibaba.fastjson2.JSON;
import com.yys.entity.Result;
import com.yys.util.MinioImageClassificationUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.io.IOException;

@RestController
@RequestMapping("/text")
public class TextController {

    @Autowired
    private MinioImageClassificationUtil maxioImageClassificationUtil;

    @RequestMapping("/text")
    public String text() throws IOException {
        String url ="/warningdata2024/img/08/2024-08-19/frame_1724065629_task-002_0.jpg";
        String text = maxioImageClassificationUtil.classifyImage(url);
        return JSON.toJSONString(Result.success(text));
    }
}
